<html>
	<head>
		<title>Hyrule Sports</title>
		<meta http-equiv="refresh" content="3;url=index.php">
<?php
$HOST_NAME = 'localhost';
$USERNAME = 'mrc02_login';
$PASSWORD = 'loginDB';
$DB = 'mrc0260_sportinggoodscompany';
$TABLE = 'sgc_users';

$email = $_GET['email'];
$hash = $_GET['hash'];
	
$CON = mysqli_connect($HOST_NAME,$USERNAME,$PASSWORD,$DB) or die(mysql_error());
$username = mysqli_real_escape_string($CON,$_POST['username']);
$password = md5(mysqli_real_escape_string($CON,$_POST['password']));
$query = "UPDATE $TABLE SET use_active=1 WHERE use_email ='$email' AND use_activate_hash='$hash'";
$success = mysqli_query($CON, $query) or die(mysql_error());
mysqli_close($CON);
if($success == true){
	echo '<html>
		  <body>
			<div style="margin:auto;margin-top:400px;text-align:center">
				Your account has been activated. Redirecting to main page.
			</div>
		  </body>
		  </html>';
}
else{
	echo '<html>
		  <body>
			<div style="margin:auto;margin-top:400px;text-align:center">
				Problem validating account. Please contact an administrator.
			</div>
		  </body>
		  </html>';
}


?>
